#include <stdio.h>
#include <omp.h>

// apply_assoc 函数
void apply_assoc(double A[100][100][3])
{
    #pragma omp parallel for collapse(2)
    for (int i = 0; i < 100; ++i)
    {
        for (int j = 0; j < 100; ++j)
        {
            #pragma GCC unroll 3
            for (int k = 0; k < 3; ++k)
            {
                A[i][j][k] = A[i][j][k] + 1;
            }
        }
    }
}

int main()
{
    double A[100][100][3];
    // 初始化数组元素为 0
    for (int i = 0; i < 100; ++i)
    {
        for (int j = 0; j < 100; ++j)
        {
            for (int k = 0; k < 3; ++k)
            {
                A[i][j][k] = 0;
            }
        }
    }

    // 调用 apply_assoc 函数
    apply_assoc(A);

    // 输出数组部分元素验证结果
    for (int i = 0; i < 2; ++i)
    {
        for (int j = 0; j < 2; ++j)
        {
            for (int k = 0; k < 3; ++k)
            {
                printf("A[%d][%d][%d] = %.2f\n", i, j, k, A[i][j][k]);
            }
        }
    }

    return 0;
}    